<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<!-- <script>
    var obj = {name:'',age:0,sings:{name:'',age:0},list:[]}
    Object.defineProperty(obj,'name',{
        set:function(){},
        get:function(){}
    })
    
</script> -->

<!-- <script>
    var obj = {name:'',age:30,run:()=>{console.log('run');}}
    obj.run()
    // hasOwnProperty() 判断一个属性是否在对象身上，不会沿着原型链查找，只会在对象自身查找
    // in 会沿着原型链查找
    if('toString' in obj){
    // if(obj.hasOwnProperty('toString')){
        console.log('在obj身上');
    }else{
        console.log('不在obj身上');
    }
    // isPrototypeOf（）判断一个对象是否是某个函数的原型对象
    if(Object.prototype.isPrototypeOf(RegExp)){
        console.log('是');
    }else{
        console.log('不是');
    }
</script> -->
<script>
    var obj = {name:'',age:30,run:()=>{console.log('run');}}
    Object.defineProperty(obj, 'name',{
        set:function(newss){
            console.log('修改的name属性值',newss);
        },
        get:function(){
            console.log('获取了name的值');
            return '赵四'+'!!!'
        }
    })
</script>
